<?php
class Apps_View_Helper_LabelBase extends Zend_View_Helper_Abstract {
    public $map = array();

    protected $_format = '<span class="label %s">%s</span>';

    public static function getInstance() {
        return new self();
    }

    public function toLabel($content, $class='') {
        return sprintf($this->_format, $class, $content);
    }
    public function map($idx, $label=true, $map=null) {
        if(null === $map) { $map = $this->map; }

        $xhtml = '';
        if(isset($map[$idx])) {
            $d = $map[$idx];

            $xhtml = $d[0];
            if($label) {
                $xhtml = $this->toLabel($xhtml, $d[1]);
            }
        }
        return $xhtml;
    }
}
